home *** CD-ROM | disk | FTP | other *** search
- import javax.microedition.lcdui.Canvas;
- import javax.microedition.lcdui.Displayable;
- import javax.microedition.lcdui.Graphics;
- import javax.microedition.lcdui.Image;
-
- public final class Engine extends Canvas implements Runnable {
- private Image imageBuffer;
- private Graphics imageBufferGraphics;
- boolean flag_repaint = true;
- boolean suspend = true;
- String screen_message;
- long message_time;
- long now_time;
- private int getKeyCode_LEFT;
- private int getKeyCode_RIGHT;
- private int getKeyCode_UP;
- private int getKeyCode_FIRE;
- final String[] st_m = new String[]{"GO!", "1", "2", "3"};
- private int position_across;
- private int position_along;
- private int height;
- private int height_relative;
- private int current_trick;
- private int current_frame;
- private int n_blaze_letters;
- long time_left_on_finish;
- private boolean on_fire = false;
- int arrow_pressed;
- int velocity_across;
- int velocity_vertical;
- int g_force = 6;
- boolean is_goofy;
- boolean below_is_rail;
- boolean below_is_ramp;
- int below_item_height;
- boolean high_jump_board;
- boolean after_finish;
- int tick;
- int countDown;
- long game_start_time;
- long game_freeze_time;
- long game_timeout;
- private BestScore best_score;
- private int first_item_num;
- private int last_item_num;
-
- public Engine() {
- this.best_score = BlazingBoards.best_score;
- this.imageBuffer = Image.createImage(101, 80);
- this.imageBufferGraphics = this.imageBuffer.getGraphics();
- ((Displayable)this).addCommand(BlazingBoards.allCommand[1]);
- ((Displayable)this).addCommand(BlazingBoards.allCommand[5]);
- ((Displayable)this).setCommandListener(BlazingBoards.app);
- System.out.println("create engine");
- this.startNewGame();
- (new Thread(this)).start();
- this.getKeyCode_LEFT = ((Canvas)this).getKeyCode(2);
- this.getKeyCode_RIGHT = ((Canvas)this).getKeyCode(5);
- this.getKeyCode_UP = ((Canvas)this).getKeyCode(1);
- this.getKeyCode_FIRE = ((Canvas)this).getKeyCode(8);
- }
-
- public void paint(Graphics var1) {
- var1.drawImage(this.imageBuffer, 0, 0, 20);
- this.flag_repaint = false;
- }
-
- public void showNotify() {
- System.out.println("engine show" + ((Displayable)this).isShown());
- this.suspend = false;
- this.arrow_pressed = 0;
- if (!this.after_finish) {
- long var1 = System.currentTimeMillis();
- this.game_start_time += var1 - this.now_time;
- this.now_time = var1;
- }
-
- }
-
- public void hideNotify() {
- System.out.println("engine hide" + ((Displayable)this).isShown());
- this.suspend = true;
- }
-
- public void run() {
- while(BlazingBoards.app != null) {
- try {
- if (this.suspend) {
- if (((Displayable)this).isShown()) {
- this.showNotify();
- } else {
- System.gc();
- Thread.sleep(100L);
- }
- } else {
- this.now_time = System.currentTimeMillis();
- if (this.countDown > 0) {
- if (this.now_time - this.game_start_time > 1000L) {
- this.game_start_time = this.now_time;
- --this.countDown;
- this.set_screen_message(this.st_m[this.countDown]);
- this.flag_repaint = true;
- }
- } else {
- long var1 = this.now_time - this.game_start_time;
- int var3 = (int)(var1 / 160L);
- if (var3 > this.tick) {
- this.tick = var3;
- this.nextTick();
- if (this.after_finish) {
- this.set_screen_message("FINISH!");
- }
-
- if (!this.checkGameOver()) {
- this.flag_repaint = true;
- }
- }
- }
-
- if (this.flag_repaint) {
- this.draw();
- ((Canvas)this).repaint();
-
- while(this.flag_repaint) {
- Thread.sleep(10L);
- }
- }
- }
- } catch (Exception var4) {
- System.out.println("In Run Exception " + var4);
- ((Throwable)var4).printStackTrace();
- }
- }
-
- }
-
- void startNewGame() {
- BlazingBoards.gameOverScreen = null;
- System.gc();
- this.position_across = 0;
- this.position_along = 2;
- this.height = this.height_relative = 0;
- this.high_jump_board = false;
- this.after_finish = false;
- this.time_left_on_finish = 0L;
- this.velocity_across = this.velocity_vertical = 0;
- this.current_trick = 0;
- this.current_frame = 0;
- this.n_blaze_letters = 0;
- this.on_fire = false;
- this.g_force = 6;
- this.tick = 0;
- this.first_item_num = 0;
- this.last_item_num = 0;
- this.best_score.reset();
- this.game_timeout = 150000L;
- this.countDown = 4;
- this.screen_message = null;
- this.arrow_pressed = 0;
- this.is_goofy = true;
- System.out.println("GameConst.MAX_TRICKS " + GameConst.MAX_TRICKS);
- System.out.println("reset");
- this.game_start_time = System.currentTimeMillis();
- this.now_time = this.game_start_time;
- this.draw();
- }
-
- public boolean checkGameOver() {
- if (this.timeLeft() >= 0L) {
- return false;
- } else {
- this.best_score.game_over(1);
- return true;
- }
- }
-
- public void keyPressed(int var1) {
- if (this.countDown <= 0) {
- if (this.time_left_on_finish == 0L) {
- if (this.current_trick == 0) {
- if (var1 == this.getKeyCode_LEFT) {
- this.arrow_pressed = -1;
- } else if (var1 == this.getKeyCode_RIGHT) {
- this.arrow_pressed = 1;
- } else if (var1 == this.getKeyCode_UP) {
- if (this.height == 0) {
- this.do_trick(30);
- }
- } else if (var1 == 49) {
- if (this.height_relative > 0) {
- this.do_trick(6);
- } else if (this.below_is_rail) {
- this.do_trick(13);
- } else {
- this.do_trick(19);
- }
- } else if (var1 != 50 && var1 != this.getKeyCode_FIRE) {
- if (var1 == 51) {
- if (this.height_relative > 0) {
- this.do_trick(5);
- } else if (this.below_is_rail) {
- this.do_trick(12);
- } else {
- this.do_trick(22);
- }
-
- return;
- }
-
- if (var1 == 52) {
- if (this.height_relative > 0) {
- this.do_trick(8);
- } else if (this.below_is_rail) {
- this.do_trick(14);
- } else if (this.on_fire) {
- this.do_trick(21);
- } else {
- this.do_trick(20);
- }
- } else if (var1 == 53) {
- if (this.height_relative > 0) {
- if (this.on_fire) {
- this.do_trick(11);
- }
- } else if (this.below_is_rail) {
- if (this.on_fire) {
- this.do_trick(18);
- }
- } else {
- this.do_trick(29);
- }
- } else if (var1 == 54) {
- if (this.height_relative > 0) {
- this.do_trick(7);
- } else if (this.below_is_rail) {
- this.do_trick(15);
- } else if (this.on_fire) {
- this.do_trick(24);
- } else {
- this.do_trick(23);
- }
- } else if (var1 == 55) {
- if (this.height_relative > 0) {
- this.do_trick(9);
- } else if (this.below_is_rail) {
- this.do_trick(16);
- } else if (this.on_fire) {
- this.do_trick(27);
- } else {
- this.do_trick(25);
- }
- } else if (var1 == 56) {
- if (this.height_relative == 0 && !this.below_is_rail) {
- this.do_trick(3);
- }
- } else if (var1 == 57) {
- if (this.height_relative > 0) {
- this.do_trick(10);
- } else if (this.below_is_rail) {
- this.do_trick(17);
- } else if (this.on_fire) {
- this.do_trick(28);
- } else {
- this.do_trick(26);
- }
- } else if (var1 == 48 && this.height_relative == 0 && !this.below_is_rail) {
- this.do_trick(4);
- }
- } else if (this.height_relative == 0 && this.current_trick == 0) {
- this.do_ollie();
- }
-
- }
- }
- }
- }
-
- public void keyReleased(int var1) {
- if (this.tick >= 16) {
- if (var1 == this.getKeyCode_LEFT || var1 == this.getKeyCode_RIGHT) {
- this.arrow_pressed = 0;
- }
-
- }
- }
-
- public void do_trick(int var1) {
- if (!this.after_finish) {
- if (this.current_trick == 0) {
- if (!this.high_jump_board) {
- this.current_trick = var1;
- this.current_frame = 0;
- if (this.current_trick >= 18) {
- this.velocity_vertical = 41;
- ++this.height;
- ++this.height_relative;
- this.best_score.combo_enable();
- }
-
- if (this.current_trick == 30) {
- this.high_jump_board = true;
- } else {
- this.high_jump_board = false;
- }
-
- }
- }
- }
- }
-
- public void do_fall() {
- if (this.current_trick != 2) {
- this.current_trick = 2;
- this.current_frame = 0;
- if (!this.below_is_ramp && !this.below_is_rail) {
- this.height = 0;
- } else {
- this.height = this.below_item_height;
- }
-
- this.height_relative = 0;
- this.velocity_vertical = 0;
- this.set_screen_message(Info.trick_message[2]);
- if (this.on_fire) {
- this.on_fire = false;
- this.g_force = 6;
- }
-
- this.is_goofy = true;
- this.high_jump_board = false;
- this.best_score.combo_disable();
- }
- }
-
- public void do_ollie() {
- if (!this.after_finish) {
- this.velocity_vertical = 41;
- ++this.height;
- ++this.height_relative;
- String var1 = "Ollie!+5";
- int var2 = 5;
- if (this.on_fire) {
- var1 = var1 + "x2";
- var2 *= 2;
- }
-
- this.set_screen_message(var1);
- this.best_score.add_score(var2);
- this.best_score.combo_enable();
- }
- }
-
- public void do_grind() {
- this.velocity_across = 0;
- String var1 = "50-50 Grind!+10";
- int var2 = 10;
- if (this.on_fire) {
- var1 = var1 + "x2";
- var2 *= 2;
- }
-
- this.high_jump_board = false;
- this.set_screen_message(var1);
- this.best_score.add_score(var2);
- }
-
- public void nextTick() {
- if (this.now_time - this.message_time > 3000L) {
- this.message_time = 0L;
- this.screen_message = null;
- }
-
- if (this.current_trick != 0) {
- ++this.current_frame;
- if (this.current_frame > Info.trick_frames[this.current_trick]) {
- if (Info.trick_score[this.current_trick] > 0) {
- if (this.on_fire && !Info.trick_needs_fire[this.current_trick]) {
- this.set_screen_message(Info.trick_message[this.current_trick] + "x2");
- this.best_score.add_score(Info.trick_score[this.current_trick] * 2);
- this.best_score.add_combo(Info.trick_score[this.current_trick] * 2);
- } else {
- this.set_screen_message(Info.trick_message[this.current_trick]);
- this.best_score.add_score(Info.trick_score[this.current_trick]);
- this.best_score.add_combo(Info.trick_score[this.current_trick]);
- }
- }
-
- if (this.current_trick == 6 || this.current_trick == 5 || this.current_trick == 9 || this.current_trick == 11) {
- this.is_goofy = !this.is_goofy;
- }
-
- BestScore.tricks_used[this.current_trick] = true;
- this.current_trick = 0;
- this.current_frame = 0;
- }
- }
-
- if (this.current_trick == 2) {
- this.position_along += 20;
- } else {
- this.position_along += 95;
- }
-
- this.strafe();
-
- while(this.first_item_num < GameConst.ITEM_COUNT && Info.trackItem[this.first_item_num][1] + Info.trackItem[this.first_item_num][4] <= this.position_along / 100) {
- ++this.first_item_num;
- }
-
- this.below_is_rail = false;
- this.below_is_ramp = false;
-
- for(this.last_item_num = this.first_item_num; this.last_item_num < GameConst.ITEM_COUNT && Info.trackItem[this.last_item_num][1] < this.position_along / 100 + 20; ++this.last_item_num) {
- }
-
- int var1 = this.first_item_num;
-
- while(var1 < GameConst.ITEM_COUNT) {
- if (Info.trackItem[var1][1] > this.position_along / 100) {
- var1 = GameConst.ITEM_COUNT;
- } else {
- if (this.position_across >= Info.trackItem[var1][2] && this.position_across <= Info.trackItem[var1][3]) {
- break;
- }
-
- ++var1;
- }
- }
-
- int var2 = 0;
- int var3 = 0;
- if (var1 < GameConst.ITEM_COUNT) {
- int var4 = Info.trackItem[var1][0];
- this.below_item_height = this.get_item_height(var1);
- this.below_is_rail = var4 == 2;
- this.below_is_ramp = var4 == 1;
- var2 = Info.trackItem[var1][2];
- var3 = Info.trackItem[var1][3];
- if (var4 == 4) {
- System.out.println("BONUS height " + this.height + " below_item_height " + this.below_item_height);
- if (this.height < this.below_item_height) {
- this.set_screen_message("Blaze icon!+25");
- this.best_score.add_score(25);
- this.add_blaze_letter();
- this.first_item_num = var1 + 1;
- }
- } else if (var4 == 3) {
- if (this.height < this.below_item_height) {
- this.do_fall();
- } else {
- this.set_screen_message("Highbar Ollie!+30");
- this.best_score.add_score(30);
- }
-
- this.first_item_num = var1 + 1;
- } else if (var4 == 5) {
- this.set_screen_message("CHECKPOINT!");
- this.add_time(30000L);
- this.first_item_num = var1 + 1;
- } else if (var4 == 6) {
- this.first_item_num = var1 + 1;
- this.time_left_on_finish = this.timeLeft();
- this.after_finish = true;
- } else if (var4 == 7) {
- this.first_item_num = var1 + 1;
- this.best_score.game_over(2);
- }
-
- if (this.below_is_rail && this.height_relative == 0 && this.height < this.below_item_height) {
- this.height_relative = 0;
- this.height = this.below_item_height;
- this.position_across = (var3 + var2) / 2;
- this.do_grind();
- }
-
- if (this.below_is_ramp && this.height_relative == 0 && this.height < this.below_item_height) {
- this.height_relative = 0;
- if (this.below_item_height - this.height > 30) {
- this.do_fall();
- this.velocity_across = 0 - this.velocity_across;
- }
-
- this.height = this.below_item_height;
- }
- }
-
- if (this.height_relative > 0 || !this.below_is_rail && !this.below_is_ramp && this.height > 0) {
- this.height += this.velocity_vertical;
- this.velocity_vertical -= this.g_force;
- if (!this.below_is_rail && !this.below_is_ramp) {
- this.height_relative = this.height;
- } else {
- this.height_relative = this.height - this.below_item_height;
- }
-
- if (this.height_relative <= 0) {
- if (!this.below_is_rail && !this.below_is_ramp) {
- this.height = 0;
- } else {
- this.height = this.below_item_height;
- }
-
- this.height_relative = 0;
- this.velocity_vertical = 0;
- if (this.current_trick > 4 && this.current_frame <= Info.trick_frames[this.current_trick]) {
- this.do_fall();
- return;
- }
-
- if (this.below_is_rail && this.current_trick != 2) {
- if (this.high_jump_board) {
- this.do_fall();
- return;
- }
-
- this.position_across = (var3 + var2) / 2;
- this.do_grind();
- this.do_trick(1);
- } else {
- this.high_jump_board = false;
- this.do_trick(1);
- }
- }
- }
-
- if (this.height_relative == 0 && this.best_score.combo_enabled) {
- int var5 = this.best_score.get_result_combo();
- if (var5 != 0) {
- this.best_score.add_score(var5);
- this.set_screen_message("Combo: +" + this.best_score.combo_score + "x" + this.best_score.combo_n_tricks);
- }
-
- this.best_score.combo_disable();
- }
-
- }
-
- public void strafe() {
- if (this.arrow_pressed == -1 && !this.below_is_rail) {
- if (this.velocity_across > 0) {
- this.velocity_across = 0;
- } else if (this.height_relative == 0) {
- this.velocity_across = -8;
- }
- }
-
- if (this.arrow_pressed == 1 && !this.below_is_rail) {
- if (this.velocity_across < 0) {
- this.velocity_across = 0;
- } else if (this.height_relative == 0) {
- this.velocity_across = 8;
- }
- }
-
- if (this.arrow_pressed == 0) {
- this.velocity_across = 0;
- }
-
- this.position_across += this.velocity_across;
- if (this.position_across > 44) {
- this.position_across = 44;
- this.velocity_across = 0;
- }
-
- if (this.position_across < -44) {
- this.position_across = -44;
- this.velocity_across = 0;
- }
-
- }
-
- public void set_screen_message(String var1) {
- System.out.println("set_screen_message " + var1);
- this.screen_message = var1;
- this.message_time = this.now_time;
- }
-
- public void add_blaze_letter() {
- if (!this.on_fire) {
- ++this.n_blaze_letters;
- if (this.n_blaze_letters == 5) {
- this.n_blaze_letters = 0;
- this.on_fire = true;
- this.g_force = 4;
- this.set_screen_message("BLAZING ON FIRE!");
- }
-
- }
- }
-
- public long timeLeft() {
- return this.time_left_on_finish != 0L ? this.time_left_on_finish : this.game_start_time + this.game_timeout - this.now_time;
- }
-
- public void add_time(long var1) {
- this.game_timeout += var1;
- }
-
- public int get_item_height(int var1) {
- return Info.trackItem[var1][0] == 1 ? this.ramp_height(this.position_along / 100 - Info.trackItem[var1][1], Info.trackItem[var1][4], Info.trackItem[var1][5]) : Info.trackItem[var1][5];
- }
-
- public int ramp_height(int var1, int var2, int var3) {
- return var1 > var2 ? 0 : var1 * var3 / var2;
- }
-
- void drawClippedImage(Image var1, int var2, int var3, int var4, int var5, int var6, int var7) {
- if (var2 < 101 && var2 + var6 > 0 && var6 > 0) {
- this.imageBufferGraphics.setClip(var2, var3, var6, var7);
- this.imageBufferGraphics.drawImage(var1, var2 - var4, var3 - var5, 20);
- }
- }
-
- void drawPlayerStanding(int var1, int var2, int var3, boolean var4) {
- if (var3 >= 0 && var3 < 4) {
- if (var4) {
- var3 += 4;
- }
-
- var1 -= 12;
- var2 -= 32;
- this.drawClippedImage(BlazingBoards.AllImage[2], var1, var2, 24 * var3, 0, 24, 32);
- }
-
- }
-
- void drawPlayerTwisting(int var1, int var2, int var3) {
- if (var3 >= 0 && var3 < 9) {
- var1 -= 12;
- var2 -= 32;
- this.drawClippedImage(BlazingBoards.AllImage[0], var1, var2, 24 * var3, 0, 24, 32);
- }
-
- }
-
- void drawPlayerFalling(int var1, int var2, int var3) {
- if (var3 >= 0 && var3 < 8) {
- var1 -= 15;
- var2 -= 32;
- this.drawClippedImage(BlazingBoards.AllImage[1], var1, var2, 30 * var3, 0, 30, 32);
- }
-
- }
-
- void drawBoard(int var1, int var2, int var3, int var4) {
- if (var3 >= 0 && var3 < 8) {
- var1 -= 10;
- var2 -= 16;
- this.drawClippedImage(BlazingBoards.AllImage[3], var1, var2, 20 * var3, 16 * var4, 20, 16);
- }
-
- }
-
- void drawFlame(int var1, int var2, int var3) {
- if (var3 >= 0 && var3 < 2) {
- var1 -= 12;
- var2 -= 16;
- this.drawClippedImage(BlazingBoards.AllImage[4], var1, var2, 24 * var3, 0, 24, 16);
- }
-
- }
-
- void drawShadow(int var1, int var2) {
- var1 -= 12;
- var2 -= 16;
- this.drawClippedImage(BlazingBoards.AllImage[4], var1, var2, 48, 0, 24, 16);
- }
-
- public void draw() {
- this.imageBufferGraphics.setFont(BlazingBoards.FontSmall);
- this.imageBufferGraphics.setColor(255, 255, 255);
- this.imageBufferGraphics.fillRect(0, 0, 101, 80);
- this.imageBufferGraphics.drawImage(BlazingBoards.AllImage[5], 51, 1, 17);
- this.draw_walls();
-
- for(int var1 = this.last_item_num - 1; var1 >= this.first_item_num; --var1) {
- if (Info.trackItem[var1][0] == 1) {
- this.draw_ramp(var1);
- } else if (Info.trackItem[var1][0] == 2) {
- this.draw_rail(var1);
- } else if (Info.trackItem[var1][0] == 3) {
- this.draw_bar(var1);
- } else if (Info.trackItem[var1][0] == 4) {
- this.draw_bonus(var1);
- } else if (Info.trackItem[var1][0] == 5) {
- this.draw_checkpoint(var1);
- } else if (Info.trackItem[var1][0] == 6) {
- this.draw_finish_line(var1);
- }
- }
-
- try {
- this.drawPeople();
- } catch (Exception var6) {
- System.out.println("draw People ex = " + var6);
- }
-
- this.imageBufferGraphics.setClip(0, 0, 101, 80);
- this.imageBufferGraphics.setColor(0, 0, 0);
- long var4 = this.timeLeft() / 1000L;
- String var3 = Long.toString(var4 / 60L) + ":";
- if (var4 % 60L < 10L) {
- var3 = var3 + "0";
- }
-
- var3 = var3 + Long.toString(var4 % 60L);
- int var2 = this.imageBufferGraphics.getFont().stringWidth(var3);
- this.imageBufferGraphics.setColor(255, 255, 255);
- this.imageBufferGraphics.fillRect(101 - var2 - 2, 14, var2 + 2, 14);
- this.imageBufferGraphics.setColor(0, 0, 0);
- this.imageBufferGraphics.drawString(var3, 101 - var2, 16, 20);
- this.imageBufferGraphics.drawRect(101 - var2 - 2, 14, var2 + 2, 14);
- this.imageBufferGraphics.setColor(0, 0, 0);
- var3 = Integer.toString(this.best_score.getScore());
- var2 = this.imageBufferGraphics.getFont().stringWidth(var3);
- this.imageBufferGraphics.setColor(255, 255, 255);
- this.imageBufferGraphics.fillRect(0, 14, var2 + 2, 14);
- this.imageBufferGraphics.setColor(0, 0, 0);
- this.imageBufferGraphics.drawString(var3, 2, 16, 20);
- this.imageBufferGraphics.drawRect(0, 14, var2 + 2, 14);
- var3 = Integer.toString(this.n_blaze_letters);
- var2 = this.imageBufferGraphics.getFont().stringWidth(var3);
- this.imageBufferGraphics.setColor(0, 0, 0);
- this.imageBufferGraphics.fillRect(0, 28, var2 + 2, 14);
- this.imageBufferGraphics.setColor(255, 255, 255);
- this.imageBufferGraphics.drawString(var3, 2, 30, 20);
- this.imageBufferGraphics.setColor(0, 0, 0);
- this.imageBufferGraphics.drawRect(0, 28, var2 + 2, 14);
- this.imageBufferGraphics.setColor(0, 0, 0);
- if (this.screen_message != null) {
- var2 = this.imageBufferGraphics.getFont().stringWidth(this.screen_message);
- this.imageBufferGraphics.drawString(this.screen_message, 51, 2, 17);
- }
- }
-
- void drawPeople() {
- int var1 = 51 + this.position_across;
- int var2 = 80 - this.height / 5;
- byte var3 = 80;
- int var4 = 0;
- int var5 = 0;
- this.drawShadow(var1 + this.height / 5, var3);
- if (this.current_trick == 2) {
- this.drawPlayerFalling(var1, var2, this.current_frame);
- } else {
- if (this.on_fire) {
- if (this.high_jump_board) {
- int var6 = 0;
- if (this.below_is_ramp) {
- var6 = this.below_item_height;
- }
-
- this.drawFlame(var1, var3 - var6 / 5, this.tick & 1);
- } else {
- this.drawFlame(var1, var2, this.tick & 1);
- }
- }
-
- if (this.high_jump_board && this.height_relative > 0) {
- int var21 = 0;
- if (this.below_is_ramp) {
- var21 = this.below_item_height;
- }
-
- this.drawBoard(var1, var3 - var21 / 5, 0, 0);
- if (this.is_goofy) {
- this.drawPlayerTwisting(var1, var2, 0);
- } else {
- this.drawPlayerTwisting(var1, var2, 8);
- }
-
- } else if (this.height_relative == 0 && this.current_trick < 2) {
- var4 = (byte)0;
- if (this.current_trick == 0) {
- if (this.is_goofy) {
- if (this.velocity_across < 0) {
- var4 = (byte)1;
- }
-
- if (this.velocity_across > 0) {
- var4 = (byte)2;
- }
- } else {
- if (this.velocity_across < 0) {
- var4 = (byte)2;
- }
-
- if (this.velocity_across > 0) {
- var4 = (byte)1;
- }
- }
- }
-
- if (this.current_trick == 1) {
- var4 = (byte)3;
- }
-
- this.drawPlayerStanding(var1, var2, var4, !this.is_goofy);
- } else if (this.below_is_rail || this.current_trick != 3 && this.current_trick != 4) {
- if (this.height_relative == 0 && this.below_is_rail && this.current_trick >= 12 && this.current_trick < 18) {
- byte var20 = 0;
- var4 = 1;
- if (!this.is_goofy) {
- var4 = 5;
- }
-
- if (this.current_trick == 16 && this.is_goofy || this.current_trick == 17 && this.is_goofy || this.current_trick == 12 && this.is_goofy || this.current_trick == 13 && !this.is_goofy) {
- if (this.current_frame < 3) {
- var4 += this.current_frame;
- } else if (this.current_frame > 5) {
- var4 += 7 - this.current_frame;
- } else {
- var4 += 2;
- }
- }
-
- if (this.current_trick == 16 && !this.is_goofy || this.current_trick == 17 && !this.is_goofy || this.current_trick == 12 && !this.is_goofy || this.current_trick == 13 && this.is_goofy) {
- if (this.current_frame < 3) {
- var4 -= this.current_frame;
- } else if (this.current_frame > 5) {
- var4 -= 7 - this.current_frame;
- } else {
- var4 -= 2;
- }
- }
-
- if (this.current_trick == 15) {
- var4 = 8;
- var20 = -3;
- }
-
- if (this.current_trick == 16) {
- var20 = -3;
- }
-
- if (this.current_trick == 17) {
- var20 = 3;
- }
-
- if (this.current_trick == 14) {
- var4 = 2;
- var20 = 3;
- }
-
- if (var4 > 8) {
- var4 -= 8;
- }
-
- if (var4 < 1) {
- var4 += 8;
- }
-
- this.drawPlayerTwisting(var1 + var20, var2, var4 - 1);
- this.drawBoard(var1 + var20, var2, var4 - 1, 0);
- } else if (this.height_relative > 0 && this.current_trick >= 5 && this.current_trick <= 11) {
- var4 = 1;
- if (!this.is_goofy) {
- var4 = 5;
- }
-
- if (this.current_trick != 6 && this.current_trick != 8) {
- var4 += this.current_frame;
- if (var4 > 8) {
- var4 -= 8;
- }
-
- if (var4 > 8) {
- var4 -= 8;
- }
-
- if (var4 > 8) {
- var4 -= 8;
- }
- } else {
- var4 -= this.current_frame;
- if (var4 < 1) {
- var4 += 8;
- }
- }
-
- this.drawPlayerTwisting(var1, var2, var4 - 1);
- this.drawBoard(var1, var2, var4 - 1, 0);
- } else if (this.current_trick >= 18 && this.current_trick <= 21) {
- var5 = (byte)1;
- var5 += this.current_frame;
- if (var5 > 8) {
- var5 -= 8;
- }
-
- if (var5 > 8) {
- var5 -= 8;
- }
-
- if (var5 > 8) {
- var5 -= 8;
- }
-
- this.drawBoard(var1, var2, var5 - 1, 2);
- if (this.is_goofy) {
- this.drawPlayerTwisting(var1, var2 - 12, 0);
- } else {
- this.drawPlayerTwisting(var1, var2 - 12, 8);
- }
-
- } else if (this.current_trick >= 22 && this.current_trick <= 24) {
- var5 = 1;
- var5 -= this.current_frame;
- if (var5 < 1) {
- var5 += 8;
- }
-
- if (var5 < 1) {
- var5 += 8;
- }
-
- if (var5 < 1) {
- var5 += 8;
- }
-
- this.drawBoard(var1, var2, var5 - 1, 2);
- if (this.is_goofy) {
- this.drawPlayerTwisting(var1, var2 - 12, 0);
- } else {
- this.drawPlayerTwisting(var1, var2 - 12, 8);
- }
-
- } else if (this.current_trick >= 25 && this.current_trick <= 28) {
- var5 = 1;
- var5 += this.current_frame;
- if (var5 > 8) {
- var5 -= 8;
- }
-
- if (var5 > 8) {
- var5 -= 8;
- }
-
- this.drawBoard(var1, var2, var5 - 1, 0);
- if (this.is_goofy) {
- this.drawPlayerTwisting(var1, var2 - 12, 0);
- } else {
- this.drawPlayerTwisting(var1, var2 - 12, 8);
- }
-
- } else if (this.current_trick == 29) {
- var5 = 1;
- var5 += this.current_frame;
- if (var5 > 8) {
- var5 -= 8;
- }
-
- this.drawBoard(var1, var2, var5 - 1, 1);
- if (this.is_goofy) {
- this.drawPlayerTwisting(var1, var2 - 12, 0);
- } else {
- this.drawPlayerTwisting(var1, var2 - 12, 8);
- }
-
- } else {
- if (this.is_goofy) {
- this.drawBoard(var1, var2, 0, 0);
- this.drawPlayerTwisting(var1, var2, 0);
- } else {
- this.drawBoard(var1, var2, 0, 4);
- this.drawPlayerTwisting(var1, var2, 8);
- }
-
- }
- } else {
- var4 = 1;
- if (!this.is_goofy) {
- var4 = 5;
- }
-
- if (this.current_trick == 3) {
- if (this.current_frame % 2 == 0) {
- if (this.current_frame % 4 == 0) {
- --var4;
- } else {
- ++var4;
- }
- }
-
- if (var4 > 8) {
- var4 -= 8;
- }
-
- if (var4 < 1) {
- var4 += 8;
- }
- }
-
- if (this.current_trick == 4) {
- if (this.current_frame < 4) {
- var4 += this.current_frame;
- } else {
- var4 += 8 - this.current_frame;
- }
-
- if (var4 > 8) {
- var4 -= 8;
- }
-
- if (var4 < 1) {
- var4 += 8;
- }
- }
-
- this.drawPlayerTwisting(var1, var2, var4 - 1);
- this.drawBoard(var1, var2, var4 - 1, 0);
- }
- }
- }
-
- public int get_sx(int var1, int var2) {
- return (int)(51L + (long)var1 * 350L / (long)var2);
- }
-
- public int get_sy(int var1, int var2) {
- return (int)(35L + (long)(100 - var1 / 2) * 200L / (long)var2);
- }
-
- public void draw_vertical_line(int var1, int var2, int var3, int var4) {
- int var5 = this.get_sx(var4, var1);
- int var6 = this.get_sy(var3, var1);
- int var7 = this.get_sy(var2, var1);
- if (var5 >= 0 && var5 < 101) {
- this.imageBufferGraphics.drawLine(var5, var6, var5, var7);
- this.imageBufferGraphics.drawLine(101 - var5, var6, 101 - var5, var7);
- }
-
- }
-
- public void draw_walls() {
- Graphics var1 = this.imageBufferGraphics;
- this.imageBufferGraphics.setColor(0, 0, 0);
- int var2 = this.get_sy(0, 100);
- int var3 = this.get_sy(260, 100);
- int var4 = this.get_sy(0, 2000);
- int var5 = this.get_sy(260, 2000);
- int var10000 = var4 - var2;
- var10000 = var5 - var3;
-
- for(int var8 = -60; var8 <= 60; var8 += 120) {
- int var9 = this.get_sx(var8, 100);
- int var10 = this.get_sx(var8, 2000);
- if (var3 >= var5) {
- if (var10 <= 51) {
- this.imageBufferGraphics.drawLine(0, var5, var10, var5);
- }
-
- if (var10 >= 51) {
- this.imageBufferGraphics.drawLine(var10, var5, 101, var5);
- }
- }
-
- this.imageBufferGraphics.drawLine(var9, var3, var10, var5);
- this.imageBufferGraphics.drawLine(var9, var2, var10, var4);
- this.imageBufferGraphics.drawLine(var10, var5, var10, var4);
- this.imageBufferGraphics.drawLine(var10, var4, 51, var4);
- }
-
- int var13 = 0;
- int var15 = this.position_along / 100;
- int var11 = this.position_along % 100;
-
- for(int var12 = 3 - var15 % 3; var12 < 20; var12 += 3) {
- var13 = 100 * var12 - var11;
- this.draw_vertical_line(var13, 0, 260, -60);
- }
-
- }
-
- public void draw_ramp(int var1) {
- int var2 = this.position_along / 100 - 4;
- int var3 = this.position_along % 100;
- int var4 = (Info.trackItem[var1][1] - var2) * 100 - var3;
- if (var4 <= 0) {
- var4 = 100;
- }
-
- int var5 = (Info.trackItem[var1][1] + Info.trackItem[var1][4] - var2) * 100 - var3;
- if (var5 > 2000) {
- var5 = 2000;
- }
-
- if (var5 > var4) {
- int var6 = this.get_sx(Info.trackItem[var1][2], var4);
- int var7 = this.get_sx(Info.trackItem[var1][3], var4);
- int var8 = this.get_sy(0, var4);
- int var9 = this.get_sx(Info.trackItem[var1][2], var5);
- int var10 = this.get_sx(Info.trackItem[var1][3], var5);
- int var11 = this.get_sy(0, var5);
- int var12 = this.get_sy(Info.trackItem[var1][5], var5);
- this.imageBufferGraphics.setColor(0, 0, 0);
- this.imageBufferGraphics.drawLine(var6, var8, var9, var11);
- this.imageBufferGraphics.drawLine(var7, var8, var10, var11);
- this.imageBufferGraphics.drawLine(var9, var11, var10, var11);
- this.imageBufferGraphics.drawLine(var9, var12, var9, var11);
- this.imageBufferGraphics.drawLine(var10, var12, var10, var11);
- this.imageBufferGraphics.setColor(255, 255, 255);
- int var13 = var8 - var12;
- int var14 = var6 - var9;
- int var15 = var7 - var10;
-
- for(int var16 = 0; var16 < var13 && var16 + var12 <= 80; ++var16) {
- this.imageBufferGraphics.drawLine(var9 + (int)((long)var16 * (long)var14 / (long)var13), var16 + var12, var10 + (int)((long)var16 * (long)var15 / (long)var13), var16 + var12);
- }
-
- this.imageBufferGraphics.setColor(0, 0, 0);
- this.imageBufferGraphics.drawLine(var6, var8, var7, var8);
- this.imageBufferGraphics.drawLine(var9, var12, var10, var12);
- this.imageBufferGraphics.drawLine(var6, var8, var9, var12);
- this.imageBufferGraphics.drawLine(var7, var8, var10, var12);
- }
- }
-
- public void draw_rail(int var1) {
- int var2 = this.position_along / 100 - 4;
- int var3 = this.position_along % 100;
- int var4 = (Info.trackItem[var1][1] - var2) * 100 - var3;
- if (var4 <= 0) {
- var4 = 100;
- }
-
- int var5 = (Info.trackItem[var1][1] + Info.trackItem[var1][4] - var2) * 100 - var3;
- if (var5 > 2000) {
- var5 = 2000;
- }
-
- if (var5 > var4) {
- int var6 = (Info.trackItem[var1][2] + Info.trackItem[var1][3]) / 2;
- int var7 = this.get_sx(var6, var4);
- int var8 = this.get_sx(var6, var5);
- int var9 = this.get_sy(0, var4);
- int var10 = this.get_sy(Info.trackItem[var1][5], var4);
- int var11 = this.get_sy(0, var5);
- int var12 = this.get_sy(Info.trackItem[var1][5], var5);
- this.imageBufferGraphics.setColor(90, 90, 90);
- this.imageBufferGraphics.drawLine(var7, var9, var8, var11);
- this.imageBufferGraphics.setColor(0, 0, 0);
- this.imageBufferGraphics.drawLine(var7, var10, var8, var12);
- this.imageBufferGraphics.drawLine(var7 - 1, var10, var8 - 1, var12);
- this.imageBufferGraphics.drawLine(var7 + 1, var10, var8 + 1, var12);
- this.imageBufferGraphics.drawLine(var7, var10, var7, var9);
- this.imageBufferGraphics.drawLine(var8, var12, var8, var11);
- }
- }
-
- public void draw_bonus(int var1) {
- int var2 = this.position_along / 100 - 4;
- int var3 = this.position_along % 100;
- int var4 = (Info.trackItem[var1][1] - var2) * 100 - var3;
- if (var4 <= 0) {
- var4 = 100;
- }
-
- int var5 = this.get_sx(Info.trackItem[var1][2], var4);
- int var6 = this.get_sx(Info.trackItem[var1][3], var4);
- int var7 = this.get_sy(0, var4);
- int var8 = this.get_sy(Info.trackItem[var1][5], var4);
- this.imageBufferGraphics.setColor(255, 255, 255);
- int var9 = var6 - var5;
- int var10 = var7 - var8;
- this.imageBufferGraphics.fillRect(var5, var8, var9, var10);
- this.imageBufferGraphics.setColor(0, 0, 0);
- this.imageBufferGraphics.drawRect(var5, var8, var9, var10);
- if (var10 > 7) {
- this.imageBufferGraphics.setColor(0, 0, 0);
- this.imageBufferGraphics.drawLine(var5 + 2, var8 + 2, var5 + 2, var7 - 2);
- this.imageBufferGraphics.drawLine(var5 + 2, var8 + 2, var5 + var10 / 2, var8 + 2);
- this.imageBufferGraphics.drawLine(var5 + 2, var7 - 2, var5 + var10 / 2, var7 - 2);
- this.imageBufferGraphics.drawLine(var5 + 2, var8 + var10 / 2, var5 + var10 / 2, var8 + 2);
- this.imageBufferGraphics.drawLine(var5 + 2, var8 + var10 / 2, var5 + var10 / 2, var7 - 2);
- }
-
- }
-
- public void draw_bar(int var1) {
- int var2 = this.position_along / 100 - 4;
- int var3 = this.position_along % 100;
- int var4 = (Info.trackItem[var1][1] - var2) * 100 - var3;
- if (var4 <= 0) {
- var4 = 100;
- }
-
- int var5 = this.get_sx(Info.trackItem[var1][2], var4);
- int var6 = this.get_sx(Info.trackItem[var1][3], var4);
- int var7 = this.get_sy(0, var4);
- int var8 = this.get_sy(Info.trackItem[var1][5], var4);
- this.imageBufferGraphics.setColor(90, 90, 90);
- this.imageBufferGraphics.drawLine(var5, var7, var6, var7);
- this.imageBufferGraphics.drawLine(var5, var7, var5, var8);
- this.imageBufferGraphics.drawLine(var6, var7, var6, var8);
- this.imageBufferGraphics.setColor(0, 0, 0);
- this.imageBufferGraphics.drawLine(var5, var8, var6, var8);
- if (var7 - var8 > 10) {
- this.imageBufferGraphics.drawLine(var5, var8 - 1, var6, var8 - 1);
- }
-
- if (var7 - var8 > 20) {
- this.imageBufferGraphics.drawLine(var5, var8 + 1, var6, var8 + 1);
- }
-
- }
-
- public void draw_checkpoint(int var1) {
- int var2 = this.position_along / 100 - 4;
- int var3 = this.position_along % 100;
- int var4 = (Info.trackItem[var1][1] - var2) * 100 - var3;
- if (var4 <= 0) {
- var4 = 100;
- }
-
- int var5 = this.get_sx(Info.trackItem[var1][2], var4);
- int var6 = this.get_sx(Info.trackItem[var1][3], var4);
- int var7 = this.get_sy(0, var4);
- this.imageBufferGraphics.setColor(90, 90, 90);
- this.imageBufferGraphics.drawLine(var5, var7, var6, var7);
- if (var4 < 1000) {
- this.imageBufferGraphics.drawLine(var5, var7 - 1, var6, var7 - 1);
- }
-
- if (var4 < 500) {
- this.imageBufferGraphics.drawLine(var5, var7 + 1, var6, var7 + 1);
- }
-
- }
-
- public void draw_finish_line(int var1) {
- int var2 = this.position_along / 100 - 4;
- int var3 = this.position_along % 100;
- int var4 = (Info.trackItem[var1][1] - var2) * 100 - var3;
- if (var4 <= 0) {
- var4 = 100;
- }
-
- int var5 = this.get_sx(Info.trackItem[var1][2], var4);
- int var6 = this.get_sx(Info.trackItem[var1][3], var4);
- int var7 = this.get_sy(0, var4);
- this.imageBufferGraphics.setColor(0, 0, 0);
- this.imageBufferGraphics.drawLine(var5, var7, var6, var7);
- if (var4 < 1000) {
- this.imageBufferGraphics.drawLine(var5, var7 - 1, var6, var7 - 1);
- }
-
- if (var4 < 500) {
- this.imageBufferGraphics.drawLine(var5, var7 + 1, var6, var7 + 1);
- }
-
- }
- }
-